﻿
namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        /// <summary>
        /// 编辑当前公式内部第一个文本块。
        /// 如果当前公式本身就是文本块，直接编辑。
        /// </summary>
        public static void EditFstBaseText()
        {
            if (Globals.selectedEditor == null) return;

            Expressions.BaseText rb = null;

            if (Globals.selectedEditor.SelectedExpression == null)
            {
                rb = Globals.GetFstBaseText(Globals.selectedEditor.RootPanel);
            }
            else
            {
                rb = Globals.GetFstBaseText(
                    Globals.selectedEditor.SelectedExpression);
            }

            if (rb == null) return;

            Globals.selectedEditor.SelectedExpression = rb;
            Command.EditBaseText(rb);
        }
    }
}
